<?php if ($cart): ?> <!-- Si le panier n'est pas vide -->
    <table class="table table-bordered table-striped">
        <thead>
            <tr>   
                <th></th>
                <th>Description</th>
                <th>Qty</th>
                <th>Price</th>
                <th>Total</th>
            </tr>
        </thead>
        <tbody>
            <?php
            foreach ($cart as $c):
                // On récupère l'article grâce à son id, depuis le model
                $article = $this->sitemodel->getOne($c['id']);
                // On stocke le chemin vers le controller article et on appelle sa fonction show
                $show = site_url('article/show/' . $article->article_id);
                ?>
                <tr>
                    <td>
                        <a href="<?php echo $show; ?>">
                            <img src="<?php echo $this->picture_path . $article->image_name; ?>" width="100" height="100" />
                            <!-- On affiche l'image de l'article -->
                        </a>
                    </td>
                    <td><?php echo $c['name']; ?> <!-- on affiche le nom de l'article --></td>
                    <td>
                        <span class="update_form">
                            <?php echo form_open('article/update/' . $c['rowid'], array('class'=>'form-inline')); ?>
                            <input type="hidden" name="article_id" value="<?php echo $article->article_id; ?>" />
                            <input type="hidden" name="price" value="<?php echo $c['price']; ?>" />
                            <input type="text" name="qty" class="input-small" value="<?php echo $c['qty']; ?>" />
                            <button class="btn"><i class="icon icon-pencil"></i></button>
                            <span class="delete">
                                <a onclick="return confirm('Confirmer la suppression');" href="<?php echo site_url('article/delete/'.$c['rowid']); ?>" class="btn btn-inverse"><i class="icon icon-trash icon-white"></i></a>
                            </span>
                            <?php echo form_close(); ?>
                        </span>
                    </td>
                    <td><?php echo number_format($c['price'], 2,',', ' '); ?></td>
                    <td><span class="total_for_item"><?php echo number_format($c['price'] * $c['qty'], 2, ',', ' '); ?></span> €</td>
                </tr>
            <?php endforeach; ?>
                <tr>
                    <td colspan="6">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="4">Nombre d'articles</td>
                    <td><span class="nb_article"><?php echo $total_articles; ?></span></td>
                </tr>
                <tr>
                    <td colspan="4">Total</td>
                    <td><span class="total"><?php echo number_format($total, 2,',',' '); ?></span> €</td>
                </tr>
        </tbody>
    </table>
<span><a href="<?php echo site_url('article/payer'); ?>" class="btn btn-success">Payer ma commande</a></span>
<?php else: ?>
    <h2>aucun article dans le panier</h2>
<?php endif; ?>
